/*
 * $Id: OpenCreateMapAction.java 24 2009-03-31 23:40:10Z aaron.day $
 */
package org.crazydays.gameplan.map.swing.event;


import java.awt.event.ActionEvent;

import org.crazydays.gameplan.GamePlan;
import org.crazydays.gameplan.map.swing.JCreateMapDialog;
import org.crazydays.gameplan.swing.AbstractActionWrapper;

/**
 * NewMapAction
 */
public class OpenCreateMapAction
        extends AbstractActionWrapper
{
	/** serial version uid */
	public final static long serialVersionUID =
	        "$Id: OpenCreateMapAction.java 24 2009-03-31 23:40:10Z aaron.day $"
	                .hashCode();

	/** game plan */
	protected GamePlan gamePlan;

	/**
	 * OpenCreateMapAction constructor.
	 * 
	 * @param gamePlan Game plan
	 */
	public OpenCreateMapAction(GamePlan gamePlan)
	{
		super("New Map", loadIcon("/com/famfamfam/silk/world_add.png"));

		putValue(SHORT_DESCRIPTION, null);
		putValue(MNEMONIC_KEY, null);
		setGamePlan(gamePlan);
	}

	/**
	 * Set game plan.
	 * 
	 * @param gamePlan Game plan
	 */
	public void setGamePlan(GamePlan gamePlan)
	{
		this.gamePlan = gamePlan;
	}

	/**
	 * Get game plan.
	 * 
	 * @return Game plan
	 */
	public GamePlan getGamePlan()
	{
		return gamePlan;
	}

	/**
	 * Perform action.
	 * 
	 * @param e Event
	 * @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
	 */
	public void actionPerformed(ActionEvent e)
	{
		/** create map dialog */
		JCreateMapDialog createMapDialog =
		        new JCreateMapDialog(getGamePlan());

		createMapDialog.setAlwaysOnTop(true);
		createMapDialog.setVisible(true);
	}
}
